<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>db管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- 确保适当的绘制和触屏缩放 -->
    <link rel="stylesheet" href="{$url_css}/bootstrap.min.css" type="text/css">
    <script type="text/javascript" src="{$url_js}jquery-1.12.0.min.js"></script>
</head>
<body>
    <div class="container" style="width:96%">
        <form action="">
            <table class="table table-bordered table-striped" align="center">
                <tbody>
                    <tr align="center">
                        <td width="12%">集合名称</td>
                        <td width="6%">操作</td>
                    </tr>
                    {if !empty($info)}
                        {foreach $info as $k =>$v}
                            <tr align="center" id="i{$k}">
                                <td>{$v}</td>
                                <td>
                                    <a class="btn btn-danger" onclick="deletedb('{$v}','{$db}')">删除</a>
                                </td>
                            </tr>
                        {/foreach}
                    {/if}
                </tbody>
            </table>
        </form>
    </div>
    {literal}
        <script>
            function deletedb(name,db) {
                top.swal({
                    title: "您确定要清除吗？",
                    type: "warning",
                    showCancelButton: true,
                    closeOnConfirm: false,
                    confirmButtonText: "是的，我要删除！",
                    cancelButtonText: "取消",
                    confirmButtonColor: "#ec6c62"
                }, function () {
                    $.ajax({
                        url: 'mongodbMenege.php?do=Delete',
                        type: 'get',
                        data: {'collection': name,'db':db},
                        dataType: 'json',
                        success:function(rel){
                            if(rel.type == 'yes'){
                                $("#i"+name).remove();
                                setTimeout(function () {
                                    top.swal("删除成功！", "操作成功", "success")
                                }, 100);
                            }else {
                                top.swal("删除失败！", "操作失败", "error");
                            }
                        }
                    });
                });
            }
        </script>
    {/literal}
</body>
</html>